﻿<!DOCTYPE>

<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
    <title>订单缺件信息</title>
    <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
    <style type="text/css">
        table tr td{padding:0px 5px}
    </style>
</head>
<body>
      <div class="panelSection">    
        <div class="easyui-panel " title="查询区域" style="padding:3px;" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false"> 
           <form id="searchForm" method="post">
	    	<table>
	    		<tr class="divLabel">
	    			<td>生产订单号:</td>
                    <td>组件物料号:</td>
                    <td>开始/结束日期:</td>
	    		</tr>
	    		<tr>
	    			<td><input class="easyui-textbox" type="text" name="AUFNR" style="width: 120px; height: 22px" /></td>
                    <td><input class="easyui-textbox" type="text" name="IDNRK" style="width: 120px; height: 22px"/></td>
	    			<td>
                        <input class="easyui-datebox" name="GSTRP" style="width: 120px; height: 22px" />至
                        <input class="easyui-datebox" name="GLTRP" style="width: 120px; height: 22px"/>
                    </td>
                    <td><a href="javascript:void(0)" class="easyui-linkbutton linkbutton" onclick="page.searchData()">查询</a></td>
	    			<td><a href="javascript:void(0)" class="easyui-linkbutton linkbutton" onclick="page.searchReset()">重置</a></td>
	    		</tr>
	    	</table>
	    </form> 
        </div>
      </div>
      <div class="panelSection">    
        <div class="easyui-panel " title="订单缺件信息列表" style="padding:3px;" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false"> 
            <table id="MfgOrderLackMaterialsTable" style="height:540px"></table>
             <div id="pp" style="float: right" class="easyui-pagination" data-options="   
                 layout:['first','prev','next','last','manual','info'],              
                    total: 0,
                    showPageList: false,
                    showPageInfo: false,
                    showRefresh: false,
                    afterPageText:'共&nbsp{pages}&nbsp页',
                     buttons:[{
                            iconCls:'',
                            text:'Go',
                            id:'pageGo'
                    }]
                ">
                    </div>
        </div>
      </div>
      <div id="statusMessage" style="font-size: 14px; height: 40px"></div>
</body>
</html>
<script src="/InSiteWebApplication/Scripts/json2.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/CustomCommon.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/ZsJs/newselectCombox.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/ZsJs/selectUserCombox.js" type="text/javascript"></script>
<script>
/*
创建人：longb
日期：2022-12-16
描述：订单缺料js
*/
var page = {
    pagetotal: 0,
    pageSize: 20,
    pageNumber: 1,
    rootPath: getRootPath(), //网站根路径
    ajaxUrl: getRootPath() + "/Ashx/ZsHandler/ZSTransactionHandler.ashx",
    //初始化页面
    init: function () {
        page.bind();
        customizedEasyuiPagination('pp'); //定制化分页
    },
    DisableForm:function(){//表单编辑框禁止编辑
    },
    //页面事件绑定
    bind: function () {
        //订单缺料信息
        $("#MfgOrderLackMaterialsTable").datagrid({
            checkOnSelect: false,
            selectOnCheck: false,
            singleSelect: true,
            rownumbers: true,
            onLoadSuccess: function (data) {
                $('#pp').pagination('refresh', {	// 改变选项，并刷新分页栏信息
                    total: page.pagetotal,
                    pageSize: page.pageSize,
                    pageNumber: page.pageNumber
                });
                customizedEasyuiPagination('pp'); //定制化分页
            },
            sortOrder:"desc",
            remoteSort:false,
		    multiSort:true,
            columns: [[
                 { field: 'AUFNR', title: '生产订单号', width: 120},
                 { field: 'ENGINENO', title: '发动机号', width: 80 },
                 { field: 'AUART', title: '生产订单类型', width: 80 },
                 { field: 'MATNR', title: '物料号', width: 100 },
                 { field: 'MAKTX', title: '物料描述', width: 120 },
		         { field: 'USERUNIT', title: '使用分厂', width: 80 }, //--
                 { field: 'GAMNG', title: '生产订单数量', width: 80, },
                 { field: 'DISPO', title: 'MRP控制者', width: 80 },
                 { field: 'DSNAM', title: 'MRP控制着描述', width: 100 },
                 { field: 'ZZJHY', title: '分厂计划员', width: 60, },
                 { field: 'ZMODEL', title: '机型', width: 80, align: 'center' },
                 { field: 'BERID', title: '军种', width: 80, },
                 { field: 'GSTRP', title: '开始日期', width: 80 },
                 { field: 'GLTRP', title: '结束日期', width: 80},
                 { field: 'POSNR', title: '序号', width: 70 },
                 { field: 'IDNRK', title: '组件物料号', width: 100 },
                 { field: 'IDNRK_T', title: '组件名称', width: 100 },

                 { field: 'FEVOR', title: '主制单位', width: 100 },
                 { field: 'BDMNG', title: '需求数量', width: 100 },
                 { field: 'ENFMG', title: '已领料数量', width: 100 },
                 { field: 'ENFMG_N', title: '未清领数量', width: 100 },
                 { field: 'LGORT', title: '库存地点', width: 100 },
                 { field: 'ERFME', title: '计量单位', width: 100 },
                 { field: 'LABST_Y', title: '分配数量', width: 100 },
                 { field: 'LABST_Q', title: '缺料数量', width: 100 },
                 { field: 'LABST_L', title: '剩余可用数量', width: 100 }
	           ]]
        });
        
        //分页事件
        $('#pp').pagination({
            onSelectPage: function (pageNumber, pageSize) {
                customizedEasyuiPagination('pp'); //定制化分页
                page.pageSize = pageSize; page.pageNumber = pageNumber;
                page.GetMfgOrderLackMaterials();
            }
        });
        //绑定分页go按钮
        $('#pageGo').on("click", function () {
            var pageNumber = $(this).parents('tr').find('.pagination-num').val();
            page.pageNumber = pageNumber;
            page.GetMfgOrderLackMaterials();
        });
        //清除按钮
        $('#btnReset').on("click", function () {
            page.reset(true, true);
            page.pageNumber = 1; page.pagetotal = 0
            $('#pp').pagination('refresh', {
                total: page.pagetotal,
                pageSize: page.pageSize,
                pageNumber: page.pageNumber
            });
        });
    },
   
    //查询
    searchData: function () {
        page.reset(false, true);
        page.pageNumber = 1;
        page.GetMfgOrderLackMaterials();
        $('#EditorForm').form("clear");
    },
    //查询订单缺料信息
    GetMfgOrderLackMaterials: function () {
        var frdata = $('#searchForm').serializeArray();
        var data = {};
        $.each(frdata, function () {
            data[this.name] = this.value
        });
        var param = {
            action: "GetMfgOrderLackMaterials",
            pageSize: page.pageSize,
            pageNumber: page.pageNumber,
            data: JSON.stringify([data])
        };
        page.post(param, function (res) {
            if (res.Result) {
                //console.info(res);
                page.pagetotal = res.RowCount;
                $('#MfgOrderLackMaterialsTable').datagrid('loadData', res.DBTable);
            }
        });
    },
    //查询重置
    searchReset: function () {
        $('#searchForm').form('clear');
        page.bind();
    },

    //清除方法，重要！！！
    reset: function (iscondition, isresult) {
        clearMessage();
    },
    //post数据
    post: function ( param, callback) {
        $.ajax({
            type: "Post",
            url: page.ajaxUrl,
            data: param,
            cashe: false,
            async: true,
            dataType: "json",
            beforeSend: function () {
                $.messager.progress({ text: '', msg: '处理中...' });
            },
            success: function (data) {
                $.messager.progress('close');
                callback(data);
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $.messager.progress('close');
                displayMessage(XMLHttpRequest.responseText, false);
            }
        });
    }
}
$(function () {
    page.init();
});
</script>
